home *** CD-ROM | disk | FTP | other *** search
/ AltaVista Media Wrangler 2.0 / AltaVista Media Wrangler 2.0.iso / vfwsetup / setup.mst < prev    next >
Text File  |  1994-09-01  |  11KB  |  296 lines

  1. '**************************************************************************
  2. '*                  VfW 1.1 Runtime Setup
  3. '**************************************************************************
  4. '$INCLUDE 'setupapi.inc'
  5. '$INCLUDE 'mscpydis.inc'    ''System
  6. '$INCLUDE 'msdetect.inc'    ''Detects Avalilable Disk Space
  7.  
  8. ''Dialog ID's
  9. CONST WELCOME       = 100
  10. CONST ASKQUIT       = 200
  11. CONST EXITFAILURE   = 400
  12. CONST EXITQUIT      = 600
  13. CONST EXITSUCCESS   = 700
  14. CONST APPHELP       = 900
  15. CONST CHECK         = 2500
  16. CONST SMALLWIN      = 2200
  17. CONST RESTART       = 2600
  18. CONST RESTARTII     = 2700
  19.  
  20. ''Bitmap ID
  21. CONST LOGO = 1
  22.  
  23. GLOBAL SizeReq&  '' Total Disk Size required for installation
  24.  
  25. ''File Types
  26. GLOBAL WinDir$
  27. GLOBAL WinSysDir$
  28. GLOBAL WinSys32Dir$
  29. GLOBAL WINDRIVE$    ''Windows Drive Letter.
  30. GLOBAL CHECKSTATES$
  31. GLOBAL MinorVer%
  32. GLOBAL OnNT$
  33.  
  34. DECLARE SUB Install
  35. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  36. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  37. DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
  38. DECLARE SUB Reboot LIB "iniupd.dll"
  39. DECLARE fUNCTION ExitWindowsExec  LIB "User" (Exec$, Param$) AS INTEGER
  40.  
  41. INIT:
  42.   
  43.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  44.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  45.     
  46.     WIN32ENABLED% = 0
  47.     MajorVer% = GetWindowsMajorVersion()
  48.     MinorVer% = GetWindowsMinorVersion()
  49.     Processor% = GetProcessorType()
  50.     WinDir$ = GetWindowsDir()
  51.     DEST$ = GetWindowsDir()
  52.     WinSysDir$ = GetWindowsSysDir()
  53.     WinSys32Dir$ = WinDir$ + "system32"
  54.  
  55.     IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  56.     i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  57.     END
  58.     END IF
  59.  
  60.     'Prevents installation on 286
  61.     IF Processor% < 3 THEN
  62.     i% = DoMsgBox("Video for Windows requires a 386 or greater processor or emulator.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  63.     END
  64.     END IF
  65.  
  66.     ' Use Wowexec to determine version of NT.  3.1 did not stamp wowexec and wow returns 3.1 as version
  67.     IF OnWindowsNT() THEN
  68.       OnNT$ = "TRUE"
  69.       WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe")
  70.       IF WowVersion$ = "" THEN
  71.          i% = DoMsgBox("Video for Windows does not run on Windows NT 3.1.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  72.          END
  73.       END IF
  74.     END IF
  75.  
  76.     SetBitmap CUIDLL$, LOGO
  77.     SetTitle "Video for Windows 1.1 Runtime"
  78.  
  79.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  80.     IF szInf$ = "" THEN
  81.        szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  82.     END IF
  83.     ReadInfFile szInf$
  84.  
  85.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  86.  
  87. WELCOME:
  88.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  89.     IF sz$ = "CONTINUE" THEN
  90.        UIPop 1
  91.      ELSE
  92.     GOSUB ASKQUIT
  93.     GOTO WELCOME
  94.     END IF
  95.  
  96. ''Prepare Copy list and check size
  97.  
  98.     ClearCopyList
  99.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  100.  
  101. ''  Runtime files (on Windows disk)
  102. ''  Do not install OLE or MPlayer if on next release of NT or Windows
  103.  
  104.     IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN            'These files not necessary on Windows NT
  105.     AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
  106.     AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
  107.     END IF
  108.     AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  109.     AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
  110.     AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
  111.     IF OnNT$ = "TRUE" THEN
  112.     AddSectionFilesToCopyList "NT MSVideo", SrcDir$, WinSys32Dir$
  113.     ENDIF
  114. ''*************************************************************************************************************************
  115. ''*************************************************************************************************************************
  116. ''To add a DCI provider, please un-comment the AddSectionFilesToCopyList.
  117. ''
  118. ''    AddSectionFilesToCopyList "DCI Provider", SrcDir$, WinSysDir$
  119. ''*************************************************************************************************************************
  120. ''*************************************************************************************************************************
  121.  
  122. ''  Check windrive diskspace
  123.     SizeReq& = GetCopyListCost ("","", "")
  124.     IF SizeReq& <> 0 THEN
  125.     GOSUB SMALLWIN
  126.     END
  127.     END IF
  128.  
  129. Install
  130.  
  131. '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows automatically
  132. '' else, it gives the user the choice
  133.     RESTRT% = RestartListEmpty ()
  134.     Exe$ = DEST$ + "\_msrstrt.exe"
  135.     Batch$ = DEST$ + "\_mssetup.bat"
  136.     empty$ = ""
  137. RESTART:
  138.     IF RESTRT% = 0 THEN
  139.        sz$ = UIStartDlg(cuidll$, RESTART, "FInfo0DlgProc", 0, "")
  140.        IF sz$ = "REACTIVATE" THEN
  141.       GOTO RESTART
  142.        ENDIF
  143.        I% = ExitExecRestart ()
  144.        RemoveFile Exe$, cmoForce
  145.        RemoveFile Batch$, cmoForce
  146.        END
  147.     ELSE
  148.        sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  149.        IF sz$ = "CONTINUE" THEN
  150.       I% = ExitWindowsExec (Exe$, empty$)
  151.       IF I% = 0 THEN
  152.          GOTO RESTART
  153.       ELSE
  154.          END
  155.      ENDIF
  156.        ELSEIF sz$ = "EXIT" THEN
  157.       UIPopAll
  158.       END
  159.        ELSEIF sz$ = "REACTIVATE" THEN
  160.       GOTO RESTART
  161.        ELSE
  162.       UIPop 1
  163.        END IF
  164.     END IF
  165.  
  166.  
  167. QUIT:
  168.     ON ERROR GOTO ERRQUIT
  169.  
  170.     IF ERR = 0 THEN
  171.     dlg% = EXITSUCCESS
  172.     ELSEIF ERR = STFQUIT THEN
  173.     dlg% = EXITQUIT
  174.     ELSE
  175.     dlg% = EXITFAILURE
  176.     END IF
  177. QUITL1:
  178.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  179.     IF sz$ = "REACTIVATE" THEN
  180.     GOTO QUITL1
  181.     END IF
  182.     UIPop 1
  183.     END
  184.  
  185. ERRQUIT:
  186.     i% = DoMsgBox("An installation problem occured, call the product support service", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  187.     END
  188.  
  189.  
  190. ASKQUIT:
  191.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  192.  
  193.     IF sz$ = "EXIT" THEN
  194.     UIPopAll
  195. ''        ERROR STFQUIT
  196.     END
  197.     ELSEIF sz$ = "REACTIVATE" THEN
  198.     GOTO ASKQUIT
  199.     ELSE
  200.     UIPop 1
  201.     END IF
  202.     RETURN
  203.  
  204. SMALLWIN:
  205.     sz$ = UIStartDlg(CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "")
  206.     IF sz$ = "REACTIVATE" THEN
  207.     GOTO SMALLWIN
  208.     END IF
  209.     UIPop 1
  210.     RETURN
  211.  
  212. '**
  213. '** Purpose:
  214. '**     Performs all installation operations.
  215. '** Arguments:
  216. '**     none.
  217. '** Returns:
  218. '**     none.
  219. '*************************************************************************
  220. SUB Install STATIC
  221.  
  222.     SetRestartDir WinDir$
  223.     CopyFilesInCopyList
  224.  
  225. ''Updating WIN.INI and SYSTEM.INI
  226. ''Only update SYSTEM.INI  on NT or next version of Windows for other codecs
  227.  
  228. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  229.     IF VflatdPresent() = 0 THEN
  230.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  231.     END IF
  232. END IF
  233.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  234.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  235.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
  236.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
  237.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  238.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  239.     IF I% = 0  THEN
  240.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite
  241.     END IF
  242.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite
  243.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  244.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  245.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  246.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  247.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  248.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  249.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  250.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  251.  
  252. ''*************************************************************************************************************************
  253. ''*************************************************************************************************************************
  254. ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the    <provider> with your own file name
  255. ''
  256. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "udh.dll", cmoOverwrite
  257. ''  CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "<provider>", cmoOverwrite
  258. ''*************************************************************************************************************************
  259. ''*************************************************************************************************************************
  260.  
  261. ''Do not register components not installed with Video for Windows on NT or next version of Windows.
  262. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN
  263.     Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  264.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  265.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  266.  
  267. '' Mplayer
  268.     CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
  269.  
  270. END IF    ''NT and next version of Windows installation stop here.
  271.  
  272.     Run ("profdisp.exe")   
  273. END SUB
  274.  
  275. '**
  276. '** Purpose:
  277. '**     Appends a file name to the end of a directory path,
  278. '**     inserting a backslash character as needed.
  279. '** Arguments:
  280. '**     szDir$  - full directory path (with optional ending "\")
  281. '**     szFile$ - filename to append to directory
  282. '** Returns:
  283. '**     Resulting fully qualified path name.
  284. '*************************************************************************
  285. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  286.     IF szDir$ = "" THEN
  287.     MakePath = szFile$
  288.     ELSEIF szFile$ = "" THEN
  289.     MakePath = szDir$
  290.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  291.     MakePath = szDir$ + szFile$
  292.     ELSE
  293.     MakePath = szDir$ + "\" + szFile$
  294.     END IF
  295. END FUNCTION
  296.